package com.atguigu.guli.service.base.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * ClassName: ServiceMethodObjectHandler <br/>
 * Description: <br/>
 *
 * @author ZMR<br />
 * date: 2020/12/15 19:06<br/>
 * @since JDK 1.11
 */
@Component
public class ServiceMetaObjectHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        metaObject.setValue("gmtCreate", new Date());
        metaObject.setValue("gmtModified", new Date());

    }

    @Override
    public void updateFill(MetaObject metaObject) {
        metaObject.setValue("gmtModified", new Date());
    }
}
